\documentclass{ctexart}
\usepackage{listings}%插入代码
\usepackage{geometry}%设置页面大小边距等
\usepackage{graphicx}%插入图片
\usepackage{amssymb}%为了用\mathbb
\usepackage{amsmath}%数学方程的显示
\usepackage{listings}%插入代码
\usepackage{fancyhdr}%设置页眉页脚
\usepackage{lastpage}%总页数
\usepackage{hyperref}%引用网页
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{float}
\usepackage{subcaption}


\geometry{a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm}%一定要放在前面！
\pagestyle{fancy}%设置页眉页脚
\lhead{陈冠宇\ 3200102033}%页眉左
\chead{Numerical Methods for Differential Equations}%页眉中
\rhead{Project4}%章节信息
\cfoot{\thepage/\pageref{LastPage}}%当前页，记得调用前文提到的宏包
\lfoot{Zhejiang University}
\rfoot{School of Mathematical Sciences}
\renewcommand{\headrulewidth}{0.1mm}%页眉线宽，设为0可以去页眉线
\renewcommand{\footrulewidth}{0.1mm}%页脚线宽，设为0可以去页眉线
\setlength{\headwidth}{\textwidth}

\hypersetup{%设置网页链接颜色等
    colorlinks=true,%链接将会有颜色，默认是红色
    linkcolor=blue,%内部链接，那些由交叉引用生成的链接将会变为蓝色（blue）
    filecolor=magenta,%链接到本地文件的链接将会变为洋红色（magenta）
    urlcolor=blue,%链接到网站的链接将会变为蓝绿色（cyan）
    }

\lstset{
	columns=fixed,       
	% numbers=left,
	% numberstyle=\tiny\color{gray},
	frame=lrtb,
	basicstyle=\ttfamily, 
	backgroundcolor=\color[RGB]{245,245,244},
	keywordstyle=\color[RGB]{40,40,255},
	numberstyle=\footnotesize\color{darkgray},           
	commentstyle=\it\color[RGB]{0,96,96},
	stringstyle=\rmfamily\slshape\color[RGB]{128,0,0},
	showstringspaces=false,
	language=c++,
}
\newtheorem{theorem}{Theorem}
\newtheorem{proof}{Proof}
\newtheorem{solution}{Solution:}

\title{\textbf{微分方程数值解第四次大作业}}
\date{\today}

\begin{document}
\section*{Project4}
\section*{Part 0 How to run}
We have designed two main classes, including heat\_equ \& advection\_equ. We can modify requirements in input.json. The "Method" part 
can be chosen as $0~5$ for advection equation and $0~4$ for heat equations. The "index" part stands for the time-index you choose to output. 

\begin{lstlisting}
    make run
    make story
\end{lstlisting}
All the plots are in the “pic” folder.

\section*{Part 1. MOL for Heat Equations}
\subsection*{Crank-Nicolson}
\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/CN1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/CN2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/CN10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 1}
\end{figure}

\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/2CN1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/2CN2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/2CN10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 2}
\end{figure}

\subsection*{BTCS}
\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/BTCS1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/BTCS2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/BTCS10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 1}
\end{figure}

\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10BTCS1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10BTCS2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10BTCS10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 10}
\end{figure}

\subsection*{Collocation method}
\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/col1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/col2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/col10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 1}
\end{figure}

\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10col1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10col2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10col10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r =$\frac{1}{2h}$ =10}
\end{figure}

\subsection*{FTCS}
\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/05FTCS1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/05FTCS2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/05FTCS10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 0.5}
\end{figure}

\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/FTCS1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/FTCS2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/FTCS10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 1}
\end{figure}

\subsection*{Conclusion}
The 1-stage Gauss-Legendre gives the same result as Crank-Nikolson. The comparation is as above.

\subsection*{Gauss-Legendre RK Method}
\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/GL1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/GL2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/GL10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r = 1}
\end{figure}

\begin{figure}[H]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10GL1.eps}
        \caption{t = k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10GL2.eps}
        \caption{t = 2k}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./pic/10GL10.eps}
        \caption{t=10k}
    \end{subfigure}
    \caption{r =$\frac{1}{2h}$ =10}
\end{figure}

\section*{Part 2. MOL for Advection Equations}
\subsection*{k = 0.8h}


\begin{figure}[H]
    \centering
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/08ad_leapfrog.eps}
      \caption{Leapfrog}
    \end{minipage}
    \hfill
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/08ad_lax_friedrichs.eps}
      \caption{Lax-Friedrichs Method}
    \end{minipage}

    \centering
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/08ad_lax_wendorff.eps}
      \caption{Lax-Wendorff Method}
    \end{minipage}
    \hfill
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/08ad_upwind.eps}
      \caption{Upwind Method}
    \end{minipage}

    \centering
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/08ad_beam_warming.eps}
      \caption{Beam-Warming Method}
    \end{minipage}
    \hfill
    \begin{minipage}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=\textwidth]{./pic/exact.eps}
        \caption{Initial Bound}
    \end{minipage}
\end{figure}

\subsection*{k = h}
\begin{figure}[H]
    \centering
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/ad_lax_wendorff.eps}
      \caption{Leapfrog}
    \end{minipage}
    \hfill
    \begin{minipage}[t]{0.45\textwidth}
      \centering
      \includegraphics[width=\textwidth]{./pic/ad_leapfrog.eps}
      \caption{Lax-Friedrichs Method}
    \end{minipage}
\end{figure}

\end{document} 